package com.ruoyi.mdkt.controller;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.mdkt.entity.Pack;
import com.ruoyi.mdkt.service.PackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author gwl
 * @since 2022-10-22
 */
@CrossOrigin

@RestController
@RequestMapping("/mdkt/pack")
public class PackController {
    @Autowired
    private PackService packService;

    @GetMapping("/getPack/{userId}/{pageNo}/{pageSize}")
    public R getPack(@PathVariable("userId") String userId, @PathVariable("pageNo") Integer pageNo, @PathVariable("pageSize") Integer pageSize) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        Page<Pack> page = new Page<>(pageNo, pageSize);
        packService.page(page, queryWrapper);
        return R.ok(page);
    }
}

